import requests
from common.api_address import url_search_goods
from common.public import auth
from common.util import get_token


def search_goods(name):
    # 搜索商品
    # 请求头
    headers = {
        "authorization": auth,
        "token": get_token()
    }
    # 请求体
    params = {
        "name": name
    }
    response = requests.get(url=url_search_goods, headers=headers, params=params)
    from common.util import write_log
    write_log('调用了search_goods业务函数')
    return response

if __name__ == '__main__':
    response = search_goods('德云测玩具')

    print(response.json())

